import 'package:safetymonitor/generated/json/base/json_convert_content.dart';
import 'package:safetymonitor/app/data/entities/auth/dept_resp_entity.dart';
import 'package:safetymonitor/app/data/common/choice_bean.dart';


DeptRespEntity $DeptRespEntityFromJson(Map<String, dynamic> json) {
  final DeptRespEntity deptRespEntity = DeptRespEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    deptRespEntity.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    deptRespEntity.name = name;
  }
  final int? parentId = jsonConvert.convert<int>(json['parentId']);
  if (parentId != null) {
    deptRespEntity.parentId = parentId;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    deptRespEntity.sort = sort;
  }
  final int? leaderUserId = jsonConvert.convert<int>(json['leaderUserId']);
  if (leaderUserId != null) {
    deptRespEntity.leaderUserId = leaderUserId;
  }
  final String? phone = jsonConvert.convert<String>(json['phone']);
  if (phone != null) {
    deptRespEntity.phone = phone;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    deptRespEntity.email = email;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    deptRespEntity.status = status;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    deptRespEntity.createTime = createTime;
  }
  final int? flag = jsonConvert.convert<int>(json['flag']);
  if (flag != null) {
    deptRespEntity.flag = flag;
  }
  return deptRespEntity;
}

Map<String, dynamic> $DeptRespEntityToJson(DeptRespEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['parentId'] = entity.parentId;
  data['sort'] = entity.sort;
  data['leaderUserId'] = entity.leaderUserId;
  data['phone'] = entity.phone;
  data['email'] = entity.email;
  data['status'] = entity.status;
  data['createTime'] = entity.createTime;
  data['flag'] = entity.flag;
  return data;
}

extension DeptRespEntityExtension on DeptRespEntity {
  DeptRespEntity copyWith({
    int? id,
    String? name,
    int? parentId,
    int? sort,
    int? leaderUserId,
    String? phone,
    String? email,
    int? status,
    String? createTime,
    int? flag,
  }) {
    return DeptRespEntity()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..parentId = parentId ?? this.parentId
      ..sort = sort ?? this.sort
      ..leaderUserId = leaderUserId ?? this.leaderUserId
      ..phone = phone ?? this.phone
      ..email = email ?? this.email
      ..status = status ?? this.status
      ..createTime = createTime ?? this.createTime
      ..flag = flag ?? this.flag;
  }
}